package com.abaaba.project2.controller.wxcontroller;

import com.abaaba.project2.bean.Region;
import com.abaaba.project2.bean.vo.BaseRespVo;
import com.abaaba.project2.service.WxRegionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/wx/region")
public class WxRegionController {
    @Autowired
    WxRegionService wxRegionService;

    @RequestMapping("/list")
    public BaseRespVo list(Integer pid) {
        List<Region> regions = null;
        try {
            regions = wxRegionService.queryRegionByPid(pid);
        } catch (Exception e) {
            e.printStackTrace();
            return BaseRespVo.fail();
        }
        return BaseRespVo.ok(regions);
    }
}
